//
//  ViewController.swift
//  tableviewDemo
//
//  Created by 张 on 2017/12/30.
//  Copyright © 2017年 张. All rights reserved.
//

import UIKit

class ViewController:UIViewController,UITableViewDataSource,
UITableViewDelegate{

    var ares = ["山西","北京","陕西","湖北","湖南","江西","江苏","山西","北京","陕西","湖北","湖南","江西","江苏"]
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    //准备填充数据,相当于android中的adapter，获取数组中的size，显示多少行
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
         return ares.count
    }
    
    
    //准备填充数据,显示到列表中
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell",for:indexPath)
        cell.textLabel?.text = ares[indexPath.row]
        //文字前面添加图片的方法。也可以在界面中直接关联。
        //cell.imageView?.image = UIImage(name:"")
        return cell
    }
    
    //隐藏状态栏
    override var prefersStatusBarHidden: Bool{
        return true
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

